package com.wcl.demo.db;

import com.wcl.demo.model.entity.InviteMessages;
import com.wcl.demo.model.entity.InviteMessagesDao;

import java.util.List;

/**
 * Created by dllo on 15/11/24.
 */
public class MessagesHelper {
    private DaoSingleton instance = DaoSingleton.getInstance();
    private InviteMessagesDao messagesDao;

    public MessagesHelper() {
        messagesDao = instance.getMessagesDao();
    }

    /***
     * 保存申请邀请信息
     * @param messages
     */
    public void saveMessage(InviteMessages messages){
        messagesDao.insertInTx(messages);
    }
    /***
     * 删除申请邀请信息
     */
    public void deleteMessage(){
        messagesDao.deleteAll();
    }

    /***
     *
     * 查询
     */

    public List<InviteMessages> queryMessage(){
        return messagesDao.loadAll();
    }
    /***
     * 更新消息
     * @param messages
     */
    public void updateMessage(InviteMessages messages){
        messagesDao.update(messages);
    }
}
